/**
 * 
 */
package com.fita.wechat.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.demo2do.core.entity.result.HttpResult;
import com.fita.wechat.service.LocationService;
import com.fita.wechat.web.interceptor.Mobile;
import com.fita.wechat.web.interceptor.Wechat;

/**
 * @author Guangli Yan
 *
 */
@Controller
@RequestMapping("/locations")
public class LocationController {
	
	@Autowired
	private LocationService locationService;
	
    @Wechat
    @Mobile
	@RequestMapping(path = "/{locationId}/working-hours", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
	public @ResponseBody HttpResult loadByCode(@PathVariable(name = "locationId") Long locationId) {
		
		HttpResult httpResult = new HttpResult().success();
		
		Map<String, String> workingHours = locationService.listWorkingHours(locationId);
		
		httpResult.data("workingHours", workingHours);
		
		return httpResult;
	}

}
